﻿
@{
    ViewBag.Title = "GiftIntegralView";
    Layout = null;
}

<html>
<head>
    <meta charset="utf-8">
    <link rel="stylesheet" type="text/css" href="~/layui/css/layui.css" />
    <script src="~/layui/layui.js" type="text/javascript" charset="utf-8"></script>
    <script src="~/layui/jquery-3.4.1.js"></script>

    <title>会员等级管理</title>
    <style type="text/css">
        .layui-input {
            margin-top: 5px;
            height: 30px
        }

        .layui-form-label {
            width: auto;
            padding: 5px 10px;
            margin-top: 5px;
        }
    </style>
</head>
<body>
    <div>
        <fieldset class="layui-elem-field layui-field-title">
            <legend>
                查询
            </legend>
            <form class="layui-form" action="">
                <div class="layui-form-item">
                    <label class="layui-form-label">卡号/手机</label>
                    <div class="layui-input-inline">
                        <input type="text" name="title" lay-verify="title" autocomplete="off" class="layui-input" id="MC_CardID">
                    </div>

                    <label class="layui-form-label">兑换日期</label>
                    <div class="layui-input-inline">
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="date1" lay-verify="Begintiem">
                        </div>
                    </div>
                    <label class="layui-form-label">至</label>
                    <div class="layui-inline">
                        <input type="text" class="layui-input" id="date2" lay-verify="Endtiem">
                    </div>
                    <button id="searh" type="button" class="layui-btn layui-btn layui-btn-sm" style="margin-top: 5px;"><i class="layui-icon">&#xe615;搜索</i></button>
                </div>


            </form>
        </fieldset>
        <table class="layui-inline" lay-filter="table" id="cardList"></table>
    </div>



    <script>
        layui.use(['table', 'layer', 'laydate'], function () {
            var table = layui.table,
                layer = layui.layer,
                laydate = layui.laydate;
            //执行一个laydate实例
            laydate.render({
                elem: '#date1',
                trigger: 'click'//指定元素
            });
            laydate.render({
                elem: '#date2',
                trigger: 'click'//指定元素
            });






            $('#searh').on('click', function () {
                //获取输入框的值
                var MC_CardID = $('#MC_CardID').val();


                //表格重载，并传回服务器参数
                table.reload('cardList', {
                    //提交方式 Post
                    method: 'post',
                    //传回服务器的参数
                    where: {
                        'MC_CardID': MC_CardID,

                    }
                });
            })
            //载入表格
            table.render({
                elem: '#cardList',
                url: '/CountSum/GetGiftIntegralView',
                //开启分页
                page: 'true',
                cols: [
                    [{
                        type: 'checkbox'
                    }, {
                        field: 'MC_CardID',
                        width: 150,
                        title: '会员卡号',
                        sort: true
                    },
                    {
                        field: 'MC_Name',
                        width: 150,
                        title: '会员名称',
                        sort: true
                    },
                    {
                        field: 'EG_ID',
                        width: 150,
                        title: '礼品编号',
                        sort: true
                    },
                    {
                        field: 'EG_GiftName',
                        width: 150,
                        title: '礼品名称',
                        sort: true
                    },
                    {
                        field: 'EL_Point',
                        width: 150,
                        title: '所需积分',
                        sort: true,
                    },

                    {
                        field: 'EL_Number',
                        width: 150,
                        title: '数量',
                        sort: true,
                    },
                    {
                        field: 'EL_CreateTime',
                        width: 200,
                        title: '兑换时间',
                        sort: true,
                        templet: function (d) {
                            return FormatToDate(d.EL_CreateTime)
                        }

                    }

                    ]
                ]
            });
        })

        //转换日期方法
        function FormatToDate(val) {
            if (val != null) {
                var date = new Date(parseInt(val.replace("/Date(", "").replace(")/", ""), 10));
                //月份为0-11，所以+1，月份小于10时补个0
                var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
                var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
                return date.getFullYear() + "-" + month + "-" + currentDate;
            }
            return "";
        }


    </script>
</body>
</html>


